package id.co.rho.scoring.cid.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;

@Entity
@Table(name = "SCRCID_CRITERIA")
public class Criteria implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Long id;
	private String criteriaName;
	private String criteriaNumber;
	private Double criteriaRank;
	private Double criteriaWeight;
	private CriteriaType criteriaType;
	private Criteria parent;
	private List<Criteria> child = new ArrayList<Criteria>();
	private Double resultValue = new Double(0);
	private Integer location;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getCriteriaName() {
		return criteriaName;
	}

	public void setCriteriaName(String criteriaName) {
		this.criteriaName = criteriaName;
	}

	public String getCriteriaNumber() {
		return criteriaNumber;
	}

	public void setCriteriaNumber(String criteriaNumber) {
		this.criteriaNumber = criteriaNumber;
	}

	public Double getCriteriaRank() {
		return criteriaRank;
	}

	public void setCriteriaRank(Double criteriaRank) {
		this.criteriaRank = criteriaRank;
	}

	public Double getCriteriaWeight() {
		return criteriaWeight;
	}

	public void setCriteriaWeight(Double criteriaWeight) {
		this.criteriaWeight = criteriaWeight;
	}

	@Enumerated(EnumType.STRING)
	public CriteriaType getCriteriaType() {
		return criteriaType;
	}

	public void setCriteriaType(CriteriaType criteriaType) {
		this.criteriaType = criteriaType;
	}

	@ManyToOne
	public Criteria getParent() {
		return parent;
	}

	public void setParent(Criteria parent) {
		this.parent = parent;
	}

	@OneToMany(cascade = CascadeType.ALL)
	public List<Criteria> getChild() {
		return child;
	}

	public void setChild(List<Criteria> child) {
		this.child = child;
	}

	public Double getResultValue() {
		return resultValue;
	}

	public void setResultValue(Double resultValue) {
		this.resultValue = resultValue;
	}

	public Integer getLocation() {
		return location;
	}

	public void setLocation(Integer location) {
		this.location = location;
	}
	
}
